package com.schoolcloud.common.exception.handle;

import com.schoolcloud.common.exception.ServiceException;
import com.schoolcloud.common.model.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ServiceExceptionHandle {

    @ExceptionHandler(ServiceException.class)
    public R<?> handleCustomFeignException(ServiceException e) {
        return R.err(e.getCode(), e.getMessage());
    }

}
